home *** CD-ROM | disk | FTP | other *** search
/ Apple Reference & Presen…rary 8 (Internal Edition) / Apple R&P Lib Internal v8.0.iso / 5-Fonts & Software / Applications / Canvas™ 3.0 / Canvas Tools / Separations / Separations.rsrc / hd11_1010_CvHeader < prev    next >
Text File  |  1990-06-24  |  12KB  |  279 lines

  1. %%BeginProcSet:Canvas_header
  2. /CanvasDict 250 dict def
  3. CanvasDict begin
  4. systemdict/setpacking known{/origpack currentpacking def true setpacking}if
  5. /bdf{bind def}bind def
  6. /xdf{exch bind def}bdf
  7. /min{2 copy gt{exch}if pop}bdf
  8. /edf{exch def}bdf
  9. /max{2 copy lt{exch}if pop}bdf
  10. /cvmtx matrix def
  11. /currot 0 def
  12. /rotmtx matrix def
  13. /origmtx matrix def
  14. /cvangle{360 exch sub 90 add 360 mod}bdf
  15. /setrot{/currot edf rotmtx currentmatrix pop 2 copy translate currot rotate neg exch neg exch translate}bdf
  16. /endrot{rotmtx setmatrix}bdf
  17. /patspot{1 add 4 mul cvi exch 1 add 4 mul cvi exch patstr exch get exch 7 exch sub 1 exch bitshift and 0 ne{1}{0}ifelse}bdf
  18. /f/fill load def
  19. /s{1 setlinewidth penh penv scale stroke}bdf
  20. /i systemdict /image get def/T true def/F false def/dbg F def
  21. /ncolors 0 def/st0 ()def/st1 ()def/proc0 {}def
  22. /penh 1 def/penv 1 def/penv2 0 def/penh2 0 def/samplesize 0 def/width 0 def/height 0 def
  23. /SpaceExtra 0 def/LetterSpace 0 def/StringLength 0 def/NumSpaces 0 def/JustOffset 0 def
  24. /icomp    % images a color composite. approximates for b&w printer
  25. {
  26.     /ncolors edf
  27.     ncolors 1 gt
  28.     { %multiple color depth
  29.         /proc0 edf
  30.         dup dup 0 get ncolors div cvi
  31.         exch 0 3 -1 roll put
  32.         4 -1 roll ncolors div cvi 4 1 roll
  33.         {
  34.             proc0 dup/st0 edf
  35.             0 exch %start
  36.             ncolors exch %increment
  37.             length %size of string
  38.             dup ncolors sub exch ncolors div cvi string/st1 edf %destination string
  39.             {
  40.                 dup    %remember start index
  41.                 0 exch % accumulator at bottom
  42.                 dup % duplicate index
  43.                 1 exch %increment
  44.                 2 add %end at index+ 2
  45.                 {st0 exch get add}for    %only support 8 bits per sample
  46.                 3 div ncolors 4 eq{exch dup 3 1 roll 3 add st0 exch get add 255 exch sub dup 0 lt{pop 0}if}if cvi
  47.                 dup 255 gt{pop 255}if
  48.                 exch ncolors div cvi exch %knock down index to dest value
  49.                 st1 3 1 roll put
  50.             }for
  51.             st1    %leave string on stack
  52.         }    %image proc definition
  53.     }if    % more that 1 color
  54.     i
  55. }bdf
  56. /ci    %general routine for generating a color image
  57. {
  58.     /colorimage where
  59.     {pop false exch colorimage} %use existing colorimage
  60.     {icomp} %approximate with image command
  61.     ifelse
  62. }bdf
  63. %%
  64. %%    This routine redefines /s and /f (stroke and fill) to perform image patterns
  65. %%
  66. /spat
  67. {
  68.     /patstr edf
  69.     /ncolors edf
  70.     /s{ matrix currentmatrix
  71.         1 setlinewidth penh penv scale
  72.         currentflat
  73.         25 setflat    %for curves this reduced number of points
  74.         strokepath
  75.         setflat
  76.         setmatrix
  77.         impat
  78.     }def
  79.     /f{impat}def
  80. }bdf
  81. /impat        %% impat  to be used in place of stroking or filling
  82. {
  83.     /samplesize 8 ncolors mul def    % number of bytes per row of pattern
  84.     /cnt 0 def                        % current row count
  85.     currot 0 ne{currot neg rotate}if
  86.     clip
  87.     flattenpath
  88.     pathbbox
  89.     3 -1 roll
  90.     dup /starty edf
  91.     sub abs 8 div ceiling 8 mul cvi /height edf
  92.     exch dup /startx edf
  93.     sub abs samplesize div ceiling samplesize mul cvi /width edf
  94.     startx starty translate
  95.     width height scale
  96.     /colorimage where
  97.     {pop} %use existing colorimage
  98.     {
  99.         /width width ncolors mul def
  100.         /height height ncolors mul def
  101.     }ifelse
  102.     /st0 width ncolors mul string def
  103.     width height 8 [width 0 0 height neg 0 height]
  104.     {
  105.         patstr                    %string
  106.         cnt 8 mod samplesize mul    %index
  107.         samplesize                %count
  108.         getinterval
  109.         /st1 edf
  110.         0
  111.         samplesize
  112.         st0 length samplesize sub dup 0 le{pop 1}if
  113.         {st0 exch
  114.             st1
  115.             putinterval
  116.         } for
  117.         /cnt cnt 1 add def
  118.         st0
  119.     }bind
  120.     ncolors
  121.     /colorimage where
  122.     {pop ci} %use existing colorimage
  123.     {icomp}ifelse %approximate with image command
  124.     newpath    % we'll act just like stroke/fill and elimate the current path
  125. }bdf
  126. %%    images an 8 bits/sample color image where color data
  127. %%    is interlaced ie xxxxxx or RRGGBB or CCMMYYKK
  128. %%
  129. %%    width height sx sy tx ty ncolors cm
  130. /cm{
  131.     /ncolors edf
  132.     translate
  133.     scale
  134.     /height edf
  135.     /width edf
  136.     /tbitstr width string def
  137.     width height 8 [width 0 0 height neg 0 height]
  138.     {currentfile tbitstr readhexstring pop}bind
  139.     ncolors
  140.     dup 3 eq {ci}{icomp}ifelse
  141. }bdf
  142. %%    images a 1 bit/sample image given height,width and image data
  143. /im{    %%  width height sw sh tx ty im -hexdata-
  144.     translate
  145.     scale
  146.     /height edf
  147.     /width edf
  148.     /tbitstr width 7 add 8 div cvi string def
  149.     width height 1 [width 0 0 height neg 0 height]
  150.     {currentfile tbitstr readhexstring pop}bind
  151.     i
  152. }bdf
  153. /imk{    %% width height sw sh tx ty flag imk
  154.     /invFlag edf
  155.     translate
  156.     scale
  157.     /height edf
  158.     /width edf
  159.     /tbitstr width 7 add 8 div cvi string def
  160.     width height invFlag [width 0 0 height neg 0 height]
  161.     {currentfile tbitstr readhexstring pop}bind
  162.     imagemask
  163. }bdf
  164. /BeginEPSF
  165. {
  166.     /MySave save def
  167.     /dict_count countdictstack def
  168.     /op_count count 1 sub def
  169.     userdict begin
  170.     /showpage {} def
  171.     0 setgray 0 setlinecap
  172.     1 setlinewidth 0 setlinejoin
  173.     10 setmiterlimit [] 0 setdash newpath
  174.     /languagelevel where
  175.     {pop languagelevel 1 ne{false setstrokeadjust false setoverprint}if}if
  176. }bdf
  177. /EndEPSF
  178. {
  179.     count op_count sub {pop}repeat
  180.     countdictstack dict_count sub {end}repeat
  181.     MySave restore
  182. }bdf
  183. /setpat {1 currenttransfer exec 0 eq{exch pop{1 exch sub}}{pop{}}ifelse systemdict begin settransfer end /patstr edf 9.375 currot neg rotate 1 0 dtransform exch atan 0 1 dtransform exch pop 0 ge{180 add}if currot rotate/patspot load systemdict begin setscreen end}bdf
  184. systemdict/setcmykcolor known not{/setcmykcolor{/black edf 3{black add 1.0 exch sub 0.0 max 1.0 min 3 1 roll}repeat setrgbcolor}bdf}if
  185. /setpcol{/pgray edf systemdict/setcmykcolor known{/pgray 1 pgray sub def 4{0 eq{0}{pgray}ifelse 4 1 roll}repeat setcmykcolor}
  186. {setcmykcolor currentgray 1 ne{pgray}{1}ifelse setgray}ifelse}bdf
  187. /rectpath {/cv_r edf/cv_b edf/cv_l edf/cv_t edf
  188. cv_l cv_t moveto cv_r cv_t lineto cv_r cv_b lineto cv_l cv_b lineto cv_l cv_t lineto closepath}bdf
  189. /setpen {/penh edf/penv edf/penv2 penv 2 div def/penh2 penh 2 div def}bdf
  190. /dostroke{save /MySave edf not pens 1 currentgray ne or {s}if MySave restore}def
  191. /dodashfill{save /MySave edf not fills 1 currentgray ne or {gsave f grestore [] 0 setdash s}if MySave restore}def
  192. /dofill{save /MySave edf not fills 1 currentgray ne or {f}if MySave restore}def
  193. /doline{save /MySave edf not pens 1 currentgray ne or {f}if MySave restore}def
  194. /pmov{penv2 add exch penh2 sub exch moveto}bdf/plin{penv2 add exch penh2 sub exch lineto}bdf
  195. /linpath{/cv_b edf/cv_r edf/cv_t edf/cv_l edf penh2 dup cv_r exch sub/cv_r edf
  196. cv_l exch sub/cv_l edf penv2 dup cv_b add/cv_b edf cv_t add/cv_t edf cv_r cv_l gt
  197. {cv_b cv_t lt{cv_l cv_t moveto penh 0 rlineto cv_r penh add cv_b lineto 0 penv neg rlineto penh neg 0 rlineto
  198. cv_l cv_t penv neg add lineto}{cv_l cv_t moveto cv_r cv_b lineto penh 0 rlineto 0 penv neg rlineto
  199. cv_l penh add cv_t penv neg add lineto penh neg 0 rlineto 0 penv rlineto}ifelse}{cv_b cv_t lt{
  200. cv_l cv_t moveto cv_r cv_b lineto 0 penv neg rlineto penh 0 rlineto cv_l penh add cv_t penv neg add lineto 0 penv rlineto penh neg 0 rlineto}{
  201. cv_l penh add cv_t moveto cv_r penh add cv_b lineto penh neg 0 rlineto 0 penv neg rlineto
  202. cv_l cv_t penv neg add lineto penh 0 rlineto 0 penv rlineto}ifelse}ifelse closepath}bdf
  203. /dopline {/cv_pv edf/cv_ph edf currentpoint cv_ph cv_pv linpath doline newpath cv_ph cv_pv moveto}bdf
  204. /spx{SpaceExtra 0 32 4 -1 roll widthshow}bdf
  205. /lsx{SpaceExtra 0 32 LetterSpace 0 6 -1 roll awidthshow}bdf
  206. /Rjust{stringwidth pop JustOffset exch sub /JustOffset edf}bdf
  207. /Cjust{stringwidth pop 2 div JustOffset exch sub /JustOffset edf}bdf
  208. /adjfit{stringwidth pop LetterSpace StringLength 1 sub mul add SpaceExtra NumSpaces mul add dup /pw edf JustOffset exch 
  209. sub dup /wdif edf StringLength div LetterSpace add /LetterSpace edf}bdf
  210. /ulb{currentpoint pop /underlinpt edf}bdf
  211. /ule{gsave currentpoint newpath moveto currentfont dup /ft1 known{dup /ft1 get begin /FontMatrix get FontMatrix tpmx concatmatrix pop}
  212. {begin FontMatrix tpmx copy pop}ifelse FontInfo begin UnderlinePosition UnderlineThickness end end dup tpmx
  213. dtransform pop setlinewidth dup tpmx dtransform pop 0 exch rmoveto underlinpt currentpoint pop sub 0 rlineto stroke grestore}bdf
  214. /fittext{ /SpaceExtra edf /LetterSpace edf /StringLength edf /NumSpaces edf /JustOffset edf not 1 currentgray ne or
  215. {dup {ulb}if exch
  216. dbg not {dup adjfit}if
  217. lsx {ule}if}{pop pop}ifelse}bdf
  218. %% debugging aid
  219. /Debug{ gsave /Times-Roman findfont 8 scalefont setfont
  220.     gsave 0 -2 rmoveto ( adj= ) show wdif 32 string cvs show grestore
  221.     gsave 0 6 rmoveto ( width= ) show pw 32 string cvs show grestore
  222.     gsave 65 -2 rmoveto (lsp= ) show LetterSpace 32 string cvs show grestore
  223.     gsave 65 6 rmoveto (spx= ) show SpaceExtra 32 string cvs show grestore
  224.     grestore
  225. }bdf
  226. %%
  227. /cvRecFont{/encod edf FontDirectory 2 index known{cleartomark}{findfont dup length 1 add dict begin
  228. {1 index/FID ne{def}{pop pop}ifelse}forall encod{/Encoding CVvec def}if
  229. currentdict end definefont cleartomark}ifelse}bdf
  230. /wrk1 ( ) def/wdict 16 dict def
  231. /Work75 75 string def /Nmk{Work75 cvs dup}bdf /Npt{put cvn}bdf /dhOdh{Nmk 2 79 Npt}bdf /dhodh{Nmk 2 111 Npt}bdf    /dhSdh{Nmk 2 83 Npt}bdf
  232. /sfWidth{gsave 0 0 moveto 0 0 lineto 0 0 lineto 0 0 lineto closepath clip stringwidth grestore}bdf
  233. /MakOF{dup dhodh FontDirectory 1 index known{exch pop}{exch findfont dup length 1 add dict begin
  234. {1 index/FID ne 2 index /UniqueID ne and{def}{pop pop}ifelse}forall
  235. /PaintType 2 def
  236. /StrokeWidth .24 1000 mul ftSize div dup 12 lt{pop 12}if def
  237. dup currentdict end definefont pop}ifelse}bdf
  238. /fts{dup/ftSize edf}def
  239. /mkFT{/tempFT 11 dict def tempFT begin
  240. /FontMatrix [1 0 0 1 0 0] def/FontType 3 def
  241. FontDirectory 3 index get /Encoding get/Encoding exch def
  242. /proc2 edf/ft2 exch findfont def/ft1 exch findfont def/FontBBox [0 0 1 1] def
  243. /BuildChar{wdict begin/chr edf/ftdt edf/chrst wrk1 dup 0 chr put def ftdt/proc2 get exec end}def
  244. end tempFT definefont pop}bdf
  245. /OLFt{dup dhOdh FontDirectory 1 index known{exch pop}
  246. {dup 3 -1 roll dup MakOF {outproc} mkFT}ifelse}bdf
  247. /mshw{moveto show}bdf
  248. /outproc{ftdt/ft1 get setfont gsave chrst sfWidth grestore setcharwidth dblsh}bdf
  249. /dblsh{currentgray 1 setgray chrst 0 0 mshw setgray ftdt/ft2 get setfont chrst 0 0 mshw}bdf
  250. /ShadChar{ftdt/ft1 get setfont gsave chrst sfWidth 1 index 0 ne{exch .05 add exch}if grestore setcharwidth
  251. chrst .06 0 mshw 0 .05 translate dblsh}bdf
  252. /ShFt{dup dhSdh FontDirectory 1 index known{exch pop}
  253. {dup 3 -1 roll dup MakOF {ShadChar} mkFT}ifelse}bdf
  254. /LswUnits{72 75 div dup scale}bdf
  255. /erasefill{gsave 1.0 setgray fill grestore}bdf
  256. /tpmx matrix def
  257. /CVvec 256 array def
  258. /NUL/SOH/STX/ETX/EOT/ENQ/ACK/BEL/BS/HT/LF/VT/FF/CR/SO/SI/DLE/DC1/DC2/DC3/DC4/NAK/SYN/ETB/CAN/EM/SUB/ESC/FS/GS/RS/US
  259. CVvec 0 32 getinterval astore pop
  260. CVvec 32/Times-Roman findfont/Encoding get
  261. 32 96 getinterval putinterval CVvec dup 39/quotesingle put 96/grave put
  262. /Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis/Udieresis/aacute
  263. /agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute/egrave
  264. /ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde/oacute
  265. /ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex/udieresis
  266. /dagger/degree/cent/sterling/section/bullet/paragraph/germandbls
  267. /registered/copyright/trademark/acute/dieresis/notequal/AE/Oslash
  268. /infinity/plusminus/lessequal/greaterequal/yen/mu/partialdiff/summation
  269. /product/pi/integral/ordfeminine/ordmasculine/Omega/ae/oslash
  270. /questiondown/exclamdown/logicalnot/radical/florin/approxequal/Delta/guillemotleft
  271. /guillemotright/ellipsis/blank/Agrave/Atilde/Otilde/OE/oe
  272. /endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide/lozenge
  273. /ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright/fi/fl
  274. /daggerdbl/periodcentered/quotesinglbase/quotedblbase/perthousand/Acircumflex/Ecircumflex/Aacute
  275. /Edieresis/Egrave/Iacute/Icircumflex/Idieresis/Igrave/Oacute/Ocircumflex
  276. /apple/Ograve/Uacute/Ucircumflex/Ugrave/dotlessi/circumflex/tilde
  277. /macron/breve/dotaccent/ring/cedilla/hungarumlaut/ogonek/caron
  278. CVvec 128 128 getinterval astore pop
  279.